<!DOCTYPE html>
<!-- saved from url=(0045)https://sns.tianqiapi.com/sns/chatu?fid=11085 -->
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="author" content="聊天室系统配置服务 QQ: 445899710 微信: hype522147">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>微聊</title>
    <link rel="icon" href="https://sns.tianqiapi.com/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="./聊天页面_files/weui.min.css">
    <link rel="stylesheet" href="./聊天页面_files/layer.css">
    <link rel="stylesheet" href="./聊天页面_files/app.css">
        <style>
        body {
            background: #ededed;
        }

        .weui-panel {
            background: none;
        }

        .weui-panel:before, .weui-panel:after {
            border: none;
        }

        .weui-media-box__title {
            font-size: 14px;
            padding-left: 2px;
            color: #7e7e7e;
        }

        .weui-media-box__thumb {
            border-radius: 5px;
        }

        .weui-media-box {
            position: relative;
        }

        .weui-media-box__hd {
            position: absolute;
            top: 8px;
            left: 15px;
        }

        .weui-media-box__bd {
            padding-left: 50px;
        }

        .weui-media-box {
            padding: 5px 15px;
        }

        .weui-media-box_appmsg .weui-media-box__hd {
            width: 40px;
            height: 40px;
            line-height: 50px;
            text-align: center;
        }

        .saytext a, .saytextu a {
            color: #000000;
        }

        .saytextu {
            text-align: left;
        }

        .saytext, .saytextu {
            background: #fff;
            margin-top: 5px;
            padding: 10px 10px 5px;
            border-radius: 5px;
            font-size: 14px;
            display: inline-block;
        }

        .saytext .face, .saytextu .face {
            width: 25px;
        }

        .saytext img, .saytextu img {
            max-width: 100%;
        }

        .footbar {
            width: 100%;
            height: 50px;
            background: #f7f7f7;
            position: fixed;
            bottom: 0;
            left: 0;
            border-top: 1px solid #e3e3e4;
            z-index: 9999;
            overflow: hidden;
        }

        input:focus {
            outline: none;
        }

        .sayonline {
            font-size: 13px;
            padding: 5px;
            background: #f8f9fe;
            color: #0e96db;
            border: 1px solid #e4e7f8;
            width: 80%;
            margin: 10px auto;
            text-align: center;
            border-radius: .25rem;
        }

        .sayonline em {
            color: #FF0000;
        }

        .saylist {
            padding: 10px 10px;
            padding-bottom: 50px;

            /*position: absolute;
            top: 0;
            bottom: 0;*/
            overflow-y: scroll;
        }

        .emoji {
            width: 25px;
            height: 25px;
            margin: 0 3px 2px 0;
        }

        .red_img {
            background-image: url(https://sns.tianqiapi.com/img/hongbaobg.png);
            background-size: 100% 100%;
            padding: 0px 0.8rem;
            width: 200px;
            height: 80px;
        }

        .red_num {
            font-size: 22px;
            color: #ffffff;
            padding-left: 40px;
            padding-top: 8px;
            height: 25px;
        }

        .red_get {
            font-size: 14px;
            color: #ffffff;
            padding-left: 40px;
        }

        .red_box {
            display: none;
            position: fixed;
            height: 65%;
            width: 80%;
            top: 15%;
            left: 10%;
            text-align: center;
            background: #d95940;
            border-radius: 12px;
            color: orange;
            z-index: 9999;
        }

        #hb_link a {
            color: #000000
        }

        .msgboxright {
            right: 15px;
            left: auto;
            margin-right: 0;
        }

        .msgright {
            text-align: right;
            padding-right: 50px;
        }
    </style>
<link rel="stylesheet" href="./聊天页面_files/layer(1).css" id="layuicss-layer"></head>
<body>
    <div class="navbar">ccjin<img class="btnleftno" src="./聊天页面_files/left.png" onclick="location.href=&#39;/sns/talk&#39;"><img id="btnshade1" class="btn" src="./聊天页面_files/dian.png" onclick="location.href=&#39;/sns/friendInfo?id=11085&#39;">
    </div>
    <div class="line35"></div>


    <div id="saylist" class="weui-panel saylist" style="height: 366px;">
        <p>&nbsp;</p>
                                    <div id="" class="weui-panel__bd">
                    <div class="weui-media-box weui-media-box_appmsg msgbg" hover-class="weui-cell_active">
                        <div class="weui-media-box__hd weui-media-box__hd_in-appmsg">
                            <img class="weui-media-box__thumb" src="./聊天页面_files/132">
                        </div>
                        <div class="weui-media-box__bd weui-media-box__bd_in-appmsg">
                            <div class="weui-media-box__title">ccjin <span style="color: #a5a5a5; font-size: 13px;"><span style="color:#999999">14:47</span></span></div>
                            <div class="saytext">您好，欢迎来到KK人工客服，请保存好在线客服的二维码，有什么问题24小时随时联系我们，可以直接扫码进入平台！<br><img src="./聊天页面_files/chatsns_qing05.png"></div>
                        </div>
                    </div>
                </div>
                    

    </div>
    <div class="line40"></div>
    <div class="line40"></div>
    <div class="line40"></div>

    <!--footbar-->
    <div class="footbar">
        <div class="weui-flex">
            <div>
                <div style="padding: 11px 0 0 5px"><img style="width: 25px;" src="./聊天页面_files/plus-o.png" onclick="showplusbox()"></div>
            </div>
            <div class="weui-flex__item">
                <div style="padding: 8px 0 0 5px">
                    <input type="text" class="form-control" id="saytext" placeholder="说点什么" style="font-size:14px;text-indent: 5px; height: 32px; width: 100%; border-radius: 5px; border: none;" onkeydown="enterbtn(event.keyCode)" onfocus="gobottom()">
                </div>
            </div>
            <div>
                <div style="padding: 11px 0 0 8px"><img onclick="showface()" style="width: 25px;" src="./聊天页面_files/face.png"></div>
            </div>
            <!--send-->
            <div style="width: 70px;">
                <div style="padding: 8px 0 0 5px">
                    <a href="javascript:send()" class="weui-btn weui-btn_mini weui-btn_primary">发送</a>
                </div>
            </div>
        </div>
    </div>
    <div id="facelist" style="position:fixed;left:0;width:100%; bottom:51px; height:150px; background:#fff; border-top:2px solid #f1f1f1; display: none; overflow: scroll;">
        <div style="padding:10px;">
                            <img onclick="emojiclick(&#39;[二哈]&#39;)" class="emoji" src="./聊天页面_files/2018new_erha_org.png">
                            <img onclick="emojiclick(&#39;[喵喵]&#39;)" class="emoji" src="./聊天页面_files/2018new_miaomiao_thumb.png">
                            <img onclick="emojiclick(&#39;[doge]&#39;)" class="emoji" src="./聊天页面_files/2018new_doge02_org.png">
                            <img onclick="emojiclick(&#39;[抱抱]&#39;)" class="emoji" src="./聊天页面_files/2018new_baobao_thumb.png">
                            <img onclick="emojiclick(&#39;[摊手]&#39;)" class="emoji" src="./聊天页面_files/2018new_tanshou_org.png">
                            <img onclick="emojiclick(&#39;[跪了]&#39;)" class="emoji" src="./聊天页面_files/2018new_gui_org.png">
                            <img onclick="emojiclick(&#39;[给你小心心]&#39;)" class="emoji" src="./聊天页面_files/qixi2018_xiaoxinxin_thumb.png">
                            <img onclick="emojiclick(&#39;[米奇比心]&#39;)" class="emoji" src="./聊天页面_files/mickey_bixin_thumb.png">
                            <img onclick="emojiclick(&#39;[文明遛狗]&#39;)" class="emoji" src="./聊天页面_files/gongyi_wenminglgnew_thumb.png">
                            <img onclick="emojiclick(&#39;[爱你]&#39;)" class="emoji" src="./聊天页面_files/2018new_aini_org.png">
                            <img onclick="emojiclick(&#39;[允悲]&#39;)" class="emoji" src="./聊天页面_files/2018new_kuxiao_org.png">
                            <img onclick="emojiclick(&#39;[悲伤]&#39;)" class="emoji" src="./聊天页面_files/2018new_beishang_org.png">
                            <img onclick="emojiclick(&#39;[吃惊]&#39;)" class="emoji" src="./聊天页面_files/2018new_chijing_org.png">
                            <img onclick="emojiclick(&#39;[偷笑]&#39;)" class="emoji" src="./聊天页面_files/2018new_touxiao_org.png">
                            <img onclick="emojiclick(&#39;[疑问]&#39;)" class="emoji" src="./聊天页面_files/2018new_ningwen_org.png">
                            <img onclick="emojiclick(&#39;[右哼哼]&#39;)" class="emoji" src="./聊天页面_files/2018new_youhengheng_thumb.png">
                            <img onclick="emojiclick(&#39;[互粉]&#39;)" class="emoji" src="./聊天页面_files/2018new_hufen02_org.png">
                            <img onclick="emojiclick(&#39;[顶]&#39;)" class="emoji" src="./聊天页面_files/2018new_ding_org.png">
                            <img onclick="emojiclick(&#39;[污]&#39;)" class="emoji" src="./聊天页面_files/2018new_wu_thumb.png">
                            <img onclick="emojiclick(&#39;[害羞]&#39;)" class="emoji" src="./聊天页面_files/2018new_haixiu_org.png">
                            <img onclick="emojiclick(&#39;[可怜]&#39;)" class="emoji" src="./聊天页面_files/2018new_kelian_org.png">
                            <img onclick="emojiclick(&#39;[失望]&#39;)" class="emoji" src="./聊天页面_files/2018new_shiwang_thumb.png">
                            <img onclick="emojiclick(&#39;[生病]&#39;)" class="emoji" src="./聊天页面_files/2018new_shengbing_thumb.png">
                            <img onclick="emojiclick(&#39;[憧憬]&#39;)" class="emoji" src="./聊天页面_files/2018new_chongjing_org.png">
                            <img onclick="emojiclick(&#39;[黑线]&#39;)" class="emoji" src="./聊天页面_files/2018new_heixian_thumb.png">
                            <img onclick="emojiclick(&#39;[感冒]&#39;)" class="emoji" src="./聊天页面_files/2018new_kouzhao_thumb.png">
                            <img onclick="emojiclick(&#39;[亲亲]&#39;)" class="emoji" src="./聊天页面_files/2018new_qinqin_thumb.png">
                            <img onclick="emojiclick(&#39;[并不简单]&#39;)" class="emoji" src="./聊天页面_files/2018new_bingbujiandan_thumb.png">
                            <img onclick="emojiclick(&#39;[晕]&#39;)" class="emoji" src="./聊天页面_files/2018new_yun_thumb.png">
                            <img onclick="emojiclick(&#39;[吃瓜]&#39;)" class="emoji" src="./聊天页面_files/2018new_chigua_thumb.png">
                            <img onclick="emojiclick(&#39;[打脸]&#39;)" class="emoji" src="./聊天页面_files/2018new_dalian_org.png">
                            <img onclick="emojiclick(&#39;[可爱]&#39;)" class="emoji" src="./聊天页面_files/2018new_keai_org.png">
                            <img onclick="emojiclick(&#39;[汗]&#39;)" class="emoji" src="./聊天页面_files/2018new_han_org.png">
                            <img onclick="emojiclick(&#39;[笑而不语]&#39;)" class="emoji" src="./聊天页面_files/2018new_xiaoerbuyu_org.png">
                            <img onclick="emojiclick(&#39;[馋嘴]&#39;)" class="emoji" src="./聊天页面_files/2018new_chanzui_org.png">
                            <img onclick="emojiclick(&#39;[抓狂]&#39;)" class="emoji" src="./聊天页面_files/2018new_zhuakuang_org.png">
                            <img onclick="emojiclick(&#39;[太开心]&#39;)" class="emoji" src="./聊天页面_files/2018new_taikaixin_org.png">
                            <img onclick="emojiclick(&#39;[坏笑]&#39;)" class="emoji" src="./聊天页面_files/2018new_huaixiao_org.png">
                            <img onclick="emojiclick(&#39;[吐]&#39;)" class="emoji" src="./聊天页面_files/2018new_tu_org.png">
                            <img onclick="emojiclick(&#39;[色]&#39;)" class="emoji" src="./聊天页面_files/2018new_huaxin_org.png">
                            <img onclick="emojiclick(&#39;[微笑]&#39;)" class="emoji" src="./聊天页面_files/2018new_weixioa02_org.png">
                            <img onclick="emojiclick(&#39;[笑cry]&#39;)" class="emoji" src="./聊天页面_files/2018new_xiaoku_thumb.png">
                            <img onclick="emojiclick(&#39;[酷]&#39;)" class="emoji" src="./聊天页面_files/2018new_ku_org.png">
                            <img onclick="emojiclick(&#39;[衰]&#39;)" class="emoji" src="./聊天页面_files/2018new_shuai_thumb.png">
                            <img onclick="emojiclick(&#39;[哼]&#39;)" class="emoji" src="./聊天页面_files/2018new_heng_thumb.png">
                            <img onclick="emojiclick(&#39;[思考]&#39;)" class="emoji" src="./聊天页面_files/2018new_sikao_org.png">
                            <img onclick="emojiclick(&#39;[怒]&#39;)" class="emoji" src="./聊天页面_files/2018new_nu_thumb.png">
                            <img onclick="emojiclick(&#39;[鼓掌]&#39;)" class="emoji" src="./聊天页面_files/2018new_guzhang_thumb.png">
                            <img onclick="emojiclick(&#39;[钱]&#39;)" class="emoji" src="./聊天页面_files/2018new_qian_thumb.png">
                            <img onclick="emojiclick(&#39;[困]&#39;)" class="emoji" src="./聊天页面_files/2018new_kun_thumb.png">
                            <img onclick="emojiclick(&#39;[舔屏]&#39;)" class="emoji" src="./聊天页面_files/2018new_tianping_thumb.png">
                            <img onclick="emojiclick(&#39;[拜拜]&#39;)" class="emoji" src="./聊天页面_files/2018new_baibai_thumb.png">
                            <img onclick="emojiclick(&#39;[嘘]&#39;)" class="emoji" src="./聊天页面_files/2018new_xu_org.png">
                            <img onclick="emojiclick(&#39;[左哼哼]&#39;)" class="emoji" src="./聊天页面_files/2018new_zuohengheng_thumb.png">
                            <img onclick="emojiclick(&#39;[阴险]&#39;)" class="emoji" src="./聊天页面_files/2018new_yinxian_org.png">
                            <img onclick="emojiclick(&#39;[怒骂]&#39;)" class="emoji" src="./聊天页面_files/2018new_zhouma_thumb.png">
                            <img onclick="emojiclick(&#39;[费解]&#39;)" class="emoji" src="./聊天页面_files/2018new_wenhao_thumb.png">
                            <img onclick="emojiclick(&#39;[挤眼]&#39;)" class="emoji" src="./聊天页面_files/2018new_jiyan_org.png">
                            <img onclick="emojiclick(&#39;[闭嘴]&#39;)" class="emoji" src="./聊天页面_files/2018new_bizui_org.png">
                            <img onclick="emojiclick(&#39;[嘻嘻]&#39;)" class="emoji" src="./聊天页面_files/2018new_xixi_thumb.png">
                            <img onclick="emojiclick(&#39;[哈欠]&#39;)" class="emoji" src="./聊天页面_files/2018new_dahaqian_org.png">
                            <img onclick="emojiclick(&#39;[委屈]&#39;)" class="emoji" src="./聊天页面_files/2018new_weiqu_thumb.png">
                            <img onclick="emojiclick(&#39;[泪]&#39;)" class="emoji" src="./聊天页面_files/2018new_leimu_org.png">
                            <img onclick="emojiclick(&#39;[鄙视]&#39;)" class="emoji" src="./聊天页面_files/2018new_bishi_org.png">
                            <img onclick="emojiclick(&#39;[哈哈]&#39;)" class="emoji" src="./聊天页面_files/2018new_haha_thumb.png">
                            <img onclick="emojiclick(&#39;[傻眼]&#39;)" class="emoji" src="./聊天页面_files/2018new_shayan_org.png">
                            <img onclick="emojiclick(&#39;[挖鼻]&#39;)" class="emoji" src="./聊天页面_files/2018new_wabi_thumb.png">
                            <img onclick="emojiclick(&#39;[睡]&#39;)" class="emoji" src="./聊天页面_files/2018new_shuijiao_thumb.png">
                            <img onclick="emojiclick(&#39;[白眼]&#39;)" class="emoji" src="./聊天页面_files/2018new_landelini_org.png">
                            <img onclick="emojiclick(&#39;[NO]&#39;)" class="emoji" src="./聊天页面_files/2018new_no_org.png">
                            <img onclick="emojiclick(&#39;[赞]&#39;)" class="emoji" src="./聊天页面_files/2018new_zan_org.png">
                            <img onclick="emojiclick(&#39;[作揖]&#39;)" class="emoji" src="./聊天页面_files/2018new_zuoyi_org.png">
                            <img onclick="emojiclick(&#39;[haha]&#39;)" class="emoji" src="./聊天页面_files/2018new_hahashoushi_org.png">
                            <img onclick="emojiclick(&#39;[握手]&#39;)" class="emoji" src="./聊天页面_files/2018new_woshou_thumb.png">
                            <img onclick="emojiclick(&#39;[拳头]&#39;)" class="emoji" src="./聊天页面_files/2018new_quantou_thumb.png">
                            <img onclick="emojiclick(&#39;[ok]&#39;)" class="emoji" src="./聊天页面_files/2018new_ok_org.png">
                            <img onclick="emojiclick(&#39;[good]&#39;)" class="emoji" src="./聊天页面_files/2018new_good_org.png">
                            <img onclick="emojiclick(&#39;[弱]&#39;)" class="emoji" src="./聊天页面_files/2018new_ruo_org.png">
                            <img onclick="emojiclick(&#39;[加油]&#39;)" class="emoji" src="./聊天页面_files/2018new_jiayou_org.png">
                            <img onclick="emojiclick(&#39;[来]&#39;)" class="emoji" src="./聊天页面_files/2018new_guolai_thumb.png">
                            <img onclick="emojiclick(&#39;[耶]&#39;)" class="emoji" src="./聊天页面_files/2018new_ye_thumb.png">
                            <img onclick="emojiclick(&#39;[广告]&#39;)" class="emoji" src="./聊天页面_files/2018new_guanggao_thumb.png">
                            <img onclick="emojiclick(&#39;[中国赞]&#39;)" class="emoji" src="./聊天页面_files/2018new_zhongguozan_org.png">
                            <img onclick="emojiclick(&#39;[心]&#39;)" class="emoji" src="./聊天页面_files/2018new_xin_org.png">
                    </div>
    </div>
    <div id="plusbox" style="position:fixed;left:0;width:100%; bottom:51px; height:90px; background:#f6f6f6; border-top:2px solid #cfcfd0; display: none;">
        <div style="padding:10px;">
            <img src="./聊天页面_files/btn_img.png" width="60" onclick="uploadImg()">
            <a href="javascript:showmap()"><img src="./聊天页面_files/btn_map.png" width="60"></a>
                    </div>
    </div>
        <div style="display: none">
        <form id="demoForm" method="POST" enctype="multipart/form-data">
            <input type="file" id="uploadimg" name="file" onchange="uploadDo()" accept="image/png,image/jpeg">
        </form>
    </div>
        <div>
        <div class="weui-mask" id="iostask" style="opacity: 1; display: none;"></div>
        <div class="weui-actionsheet" id="iosActionsheet">
            <div class="weui-actionsheet__title">
                <p class="weui-actionsheet__title-text" style="font-size: 13px;">是否撤回该条消息?</p>
            </div>
            <div class="weui-actionsheet__menu">
                <div class="weui-actionsheet__cell" style="color: #fa5151;" onclick="delmsgdo()">确定
                </div>
            </div>
            <div class="weui-actionsheet__action">
                <div class="weui-actionsheet__cell" onclick="hideActionSheet()">取消</div>
            </div>
        </div>
    </div>
        <div style="position: fixed; bottom: 100px; right: 15px; width: 50px; height: 50px;z-index: 9999; display: none;">
        <a href="javascript:fahongbao()"><img src="./聊天页面_files/fahongbao.png" width="50"></a>
    </div>
        <div class="red_box">
        <p style="padding: 10px 15px 0; text-align: right;"><img onclick="hidehongbao()" src="./聊天页面_files/close.png" style="width: 25px;"></p>
        <p style="padding: 30px 0 0;"><img id="hb_avatar" src="./聊天页面_files/006WzJNkly8fxc42sjxisj30u00u0jub.jpg" style="width: 50px; border-radius: 6px;"></p>
        <p style="line-height: 40px; font-size: 14px;" id="hb_nickname">刘先生</p>
        <p style="padding: 30px 0; font-size: 24px; color: #ffffff" id="hb_title">恭喜发财,大吉大利</p>
        <p style="padding: 30px 0 0;" id="hb_btn"><img id="hb_kai" src="./聊天页面_files/kai.png" style="width: 80px;"></p>
        <p style="padding: 30px 0; font-size: 18px; display: none;" id="hb_link"></p>
    </div>
        <div id="subscribebox" style="text-align: center; display: none;">
        <p><img src="./聊天页面_files/qrcode.jpg" width="100%"></p>
        <p style="padding:0 30px 10px 30px;">
            <a href="javascript:location.reload();" class="weui-btn weui-btn_block weui-btn_primary">我已关注</a>
        </p>
    </div>
            <div id="volume" style="padding: 20px; display:none;">
        <div style="padding-bottom: 8px;">
            <button type="button" id="start" class="btn btn-success btn-block">点击说话</button>
        </div>
        <div style="padding-bottom: 8px;">
            <button type="button" id="stop" class="btn btn-info btn-block">说完了</button>
        </div>
        <div>
            <button type="button" id="vcancel" class="btn btn-default btn-block">取消</button>
        </div>
    </div>
    <script type="text/javascript" src="./聊天页面_files/jquery.min.js"></script>
<script type="text/javascript" src="./聊天页面_files/layer.js"></script>
<script type="text/javascript" src="./聊天页面_files/app.js"></script>
    <script src="./聊天页面_files/jquery.cookie.js"></script>
    <script type="text/javascript">
        var ws;
        var say = 0;
        var nm_time = 0;
        var nm_msgnum = 0;
        var inputfocus = 0;
        var del_guid = '';
        var fuser = {'id':11085, 'nickname': 'ccjin', 'avatar': 'http://thirdwx.qlogo.cn/mmopen/ajNVdqHZLLB7uRtyrxL5h5qNMRXdWeiaQSs1t04AFGia2BV1cNrlQZ1dUz4JmSfmVTTw7pUxVpgH1lYgx3t0VTLw/132'}
        var user = {'id':11637, 'nickname': '刘先生', 'avatar': 'http://tvax1.sinaimg.cn/crop.0.0.1080.1080.180/006WzJNkly8fxc42sjxisj30u00u0jub.jpg'}
        $(function () {
            link()
            $('#saytext').on('focus', function () {
                inputfocus = 1;
            })
            $('#saytext').on('blur', function () {
                $(document).scrollTop($(document).height());
            })

            //$('#saylist').css({'height': (window.screen.height - 300) + 'px'});
            $('#saylist').css({'height': (document.documentElement.clientHeight - 300) + 'px'});
            setTimeout(function () {
                gobottom()
            }, 1000);
                    })

        function enterbtn(a) {
            if (a == 13) {
                send()
            }
        }
        function textinput() {
            layer.prompt({title: false, formType: 2, btn: ['发送', '取消']}, function (text, index) {
                if (text == '') {
                    layer.msg('说点什么吧...');
                    return;
                }
                layer.close(index);
                sendData('msg', text);
                emoji_hide();
            });
        }
        function wssend(content) {
            ws.send(content);
        }
        function preview(url) {
            layer.open({
                anim: 1,
                area: ['90%', '90%'],
                title: false,
                shadeClose: true,
                closeBtn: false,
                type: 1,
                offset: ['30px', '15px'],
                content: '<img onclick="closeimg()" src="' + url + '" width="100%" />',
            });
        }
        function closeimg() {
            layer.closeAll()
        }
        /* 发送按钮提交 */
        function send() {
            if ($('#saytext').val() == '') {
                layer.msg('说点什么吧...');
                return;
            }
            sendData('msg', $('#saytext').val());
            emoji_hide();
        }
        function sendData(keytype, saytext) {
            wssend('{"keytype":"' + keytype + '", "data" : "' + encodeURIComponent(saytext) + '"}');
            $('#saytext').val('');
        }
        function uploadImg() {
            document.getElementById('uploadimg').click();
        }
        function uploadDo() {
            var f = document.getElementById('uploadimg').files;
            console.log(f[0].type);
            var file_type = f[0].type;
            var layer_index = layer.load(0, {shade: 0.3});
            // 获取 policy 和 secret
            $.getJSON('/index/policyChat?file_type=' + file_type, function (data) {
                console.log('上传中');
                var uploadData = new FormData($('#demoForm')[0]);
                uploadData.append('policy', data.policy);
                uploadData.append('authorization', data.authorization);
                $.ajax({
                    url: 'https://v0.api.upyun.com/chatcdn',
                    type: 'POST',
                    data: uploadData,
                    dataType: 'JSON',
                    cache: false,
                    processData: false,
                    contentType: false,
                }).done(function (data, textStatus) {
                    console.log(data.url);
                    layer.close(layer_index);
                    if (data.mimetype == 'video/mp4') {
                        sendData('video', 'http://chatcdn.tianqiapi.com' + data.url);
                    } else {
                        sendData('img', 'http://chatcdn.tianqiapi.com' + data.url);
                    }
                }).fail(function (res, textStatus, error) {
                    layer.close(layer_index);
                });
            });
        }
        /* 获取URL参数 */
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)return unescape(r[2]);
            return null;
        }
        /* emoji表情 */
        function emoji() {
            console.log($('.footbar').css('height'));
            if ($('.footbar').css('height') == '50px') {
                $('.footbar').animate({height: '240px'}, 100)
                //$('#saylist').css({'padding': '10px 10px 300px'});
            }
            if ($('.footbar').css('height') == '240px') {
                emoji_hide()
            }
            gobottom()
        }
        function emoji_hide() {
            $('#facelist').hide()
        }
        /* 输出普通消息 */
        function outputhtml(guid, keytype, saytext, user_id, user_nickname, user_avatar, user_juese) {
            if (keytype == 'video') {
                var saytext_decode = '<video id="myvideo" width="100%" height="240" controls webkit-playsinline="true" playsinline="true" x-webkit-airplay="" preload="auto" x5-video-player-type="h5" x5-video-player-fullscreen="true"><source src="' + decodeURIComponent(saytext) + '" type="video/mp4"></video>';
            } else if (keytype == 'map') {
                var saytext_decode = '<a href="/sns/map?lbs=' + decodeURIComponent(saytext) + '"><img src="/img/lbs.png" width="100%" /></a>';
            } else if (keytype == 'volume') {
                var saytext_decode = '<img class=volume onclick="playsound(\'' + decodeURIComponent(saytext) + '\')" src="/img/volume.png" />';
            } else {
                var saytext_decode = decodeURIComponent(saytext);
            }
            $('#saylist').append('<div id="' + guid + '" class="weui-panel__bd"><div class="weui-media-box weui-media-box_appmsg msgbg" hover-class="weui-cell_active"><div class="weui-media-box__hd weui-media-box__hd_in-appmsg"><img class="weui-media-box__thumb" src="' + user_avatar + '"></div><div class="weui-media-box__bd weui-media-box__bd_in-appmsg"><div class="weui-media-box__title">' + user_nickname + ' <span style="color: #a5a5a5; font-size: 13px;">' + gettime() + '</span></div><div class="saytext">' + saytext_decode + '</div></div></div></div>');
            var scrollDom = document.getElementById('saylist');
            scrollDom.scrollTop = scrollDom.scrollHeight
        }
        /* 输出普通消息 - 本人 */
        function outputhtml_self(guid, keytype, saytext, user_id, user_nickname, user_avatar, user_juese) {
            if (keytype == 'video') {
                var saytext_decode = '<video id="myvideo" width="100%" height="240" controls webkit-playsinline="true" playsinline="true" x-webkit-airplay="" preload="auto" x5-video-player-type="h5" x5-video-player-fullscreen="true"><source src="' + decodeURIComponent(saytext) + '" type="video/mp4"></video>';
            } else if (keytype == 'map') {
                var saytext_decode = '<a href="/sns/map?lbs=' + decodeURIComponent(saytext) + '"><img src="/img/lbs.png" width="100%" /></a>';
            } else if (keytype == 'volume') {
                var saytext_decode = '<img class=volume onclick="playsound(\'' + decodeURIComponent(saytext) + '\')" src="/img/volume.png" />';
            } else {
                var saytext_decode = decodeURIComponent(saytext);
            }
            $('#saylist').append('<div id="' + guid + '" class="weui-panel__bd"><div class="weui-media-box weui-media-box_appmsg msgbg" ><div class="weui-media-box__hd weui-media-box__hd_in-appmsg msgboxright" style="margin-right: 0"><img class="weui-media-box__thumb" src="' + user_avatar + '"></div><div class="weui-media-box__bd weui-media-box__bd_in-appmsg msgright"><div class="weui-media-box__title">' + user_nickname + ' <span style="color: #a5a5a5; font-size: 13px;">' + gettime() + '</span></div><div class="saytextu" onclick="delmsg(\'' + guid + '\')">' + saytext_decode + '</div></div></div></div>');
            var scrollDom = document.getElementById('saylist');
            scrollDom.scrollTop = scrollDom.scrollHeight
        }
        /* 输出红包消息 */
        function outputhongbao(guid, keytype, saytext, user_id, user_nickname, user_avatar, keyid) {
            $('#saylist').append('<div class="weui-panel__bd"><div class="weui-media-box weui-media-box_appmsg msgbg" hover-class="weui-cell_active"><div class="weui-media-box__hd weui-media-box__hd_in-appmsg"><img class="weui-media-box__thumb" src="' + user_avatar + '"></div><div class="weui-media-box__bd weui-media-box__bd_in-appmsg"><div class="weui-media-box__title">' + user_nickname + '<span style="color: #a5a5a5; font-size: 13px;">' + gettime() + '</span></div><div id="red' + keyid + '" class="red_img" onclick="hongbaoinfo(' + keyid + ')"><p class="red_num">' + saytext + '</p><p class="red_get">领取红包</p></div></div></div></div>');
            var scrollDom = document.getElementById('saylist');
            scrollDom.scrollTop = scrollDom.scrollHeight
        }
        /* 输出上线消息 */
        function outputonline(saytext) {
            $('#saylist').append('<div class="alert alert-info sayonline" role="alert">' + saytext + '</div>');
        }
        /* 输出离线消息 */
        function outputoutline(saytext) {
            $('#saylist').append('<div class="alert alert-grey sayonline" role="alert">' + saytext + '</div>');
        }
        /* 输出中雷消息 */
        function outputoutlei(saytext) {
            $('#saylist').append('<div class="alert alert-info sayonline" role="alert">' + saytext + '</div>');
        }


        function link() {
            ws = new WebSocket("wss://sns.tianqiapi.com:9503");
            ws.onopen = function (event) {
                console.log('连接成功');
                // 绑定身份
                ws.send('{"keytype":"bind", "uuid":"43ee0e2bfaf57bb334cdbe10458400fe", "uid":"11637"}');
                // 开启定时器
                timer()
            };
            ws.onmessage = function (event) {
                var obj = jQuery.parseJSON(event.data);
                console.log(obj)

                if (obj.keytype == 'msg' || obj.keytype == 'video' || obj.keytype == 'map' || obj.keytype == 'volume') {
                    if (obj.uid == 11637) {
                        outputhtml_self(obj.guid, obj.keytype, obj.keytext, user.id, user.nickname, user.avatar);
                    } else {
                        if (obj.uid == fuser.id) {
                            outputhtml(obj.guid, obj.keytype, obj.keytext, fuser.id, fuser.nickname, fuser.avatar);
                        } else {
                            layer.msg('您有新的消息');
                        }
                    }
                    gobottom();
                }

                if (obj.keytype == 'delete') {
                    $('#' + obj.keytext).remove();
                }
                setTimeout(function () {
                    readmsg()
                }, 1000)
            }
            ws.onclose = function (event) {
                yichang()
                console.log("已经与服务器断开连接\r\n当前连接状态：" + this.readyState);
            };

            ws.onerror = function (event) {
                yichang()
                console.log("WebSocket异常！");
            };
        }
        function delmsg(guid) {
            del_guid = guid
            $('#iosActionsheet').addClass('weui-actionsheet_toggle');
            $('#iostask').fadeIn(200);
        }
        function delmsgdo() {
            hideActionSheet()
            sendData('delete', del_guid);
            $.ajax({
                type: 'POST',
                url: '/sns/delmsg',
                data: 'guid=' + del_guid,
                dataType: 'JSON',
                error: function () {
                    layer.alert('网络错误');
                },
                success: function (res) {
                }
            });
        }
        function timer() {
            // 心跳
            ws.send('{"keytype":"timer", "data" : "", "uid":"11637", "uuid":"43ee0e2bfaf57bb334cdbe10458400fe"}');
            setTimeout(function () {
                timer()
            }, 20000);
        }
        function yichang() {
            layer.msg('服务器连接异常');
            setTimeout(function () {
                window.location.reload();
            }, 1000);
        }
        function insertAtCursor(myField, myValue) {
            //IE 浏览器
            if (document.selection) {
                myField.focus();
                sel = document.selection.createRange();
                sel.text = myValue;
                //sel.select();
            }

            //FireFox、Chrome等
            else if (myField.selectionStart || myField.selectionStart == '0') {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;

                // 保存滚动条
                var restoreTop = myField.scrollTop;
                myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);

                if (restoreTop > 0) {
                    myField.scrollTop = restoreTop;
                }

                //myField.focus();
                myField.selectionStart = startPos + myValue.length;
                myField.selectionEnd = startPos + myValue.length;
            } else {
                myField.value += myValue;
                //myField.focus();
            }
        }

        function emojiclick(tags) {
            //insertAtCursor(document.getElementById('saytext'), tags)
            sendData('msg', tags);
            emoji_hide();
        }

        function gobottom() {
            var scrollHeight = $('#saylist').prop("scrollHeight");
            $('#saylist').animate({scrollTop: scrollHeight + 1000}, 500);
            setTimeout(function () {
                var h = $(document).height()-$(window).height() + 1000;
                $(document).scrollTop(h);
            }, 700)
        }
        function playsound(url) {
            if (url == '') {
                url = "/msg.mp3";
            }
            var audio = new Audio(url);
            audio.play();
        }

        function showblur() {
            if (inputfocus == 1) {
                inputfocus = 0;
                $('#saytext').blur();
            }
        }

        function gettime() {
            var date = new Date();
            return '<span style="color:#999999">' + timeAdd0(date.getHours()) + ':' + timeAdd0(date.getMinutes()) + '</span>';
        }
        function timeAdd0(number) {
            if (number < 10) {
                number = '0' + number;
            }
            return number
        }

        function showtips(text) {
            layer.open({
                type: 1,
                title: false,
                closeBtn: 1,
                shadeClose: true,
                skin: '',
                area: ['90%', '90%'],
                content: '<div style="padding: 10px; font-size:14px;">' + text + '</div>'
            });
        }

        function userinfo(keyid) {
            layer.open({
                type: 2,
                title: false,
                shadeClose: true,
                closeBtn: 0,
                shade: [0.3],
                area: ['100%', '240px'],
                offset: 'rb',
                anim: 2,
                content: ['/index/userinfo?keyid=' + keyid, 'no']
            });
        }
        function readmsg() {
            $.ajax({
                type: 'POST',
                url: '/sns/readmsg',
                data: 'fid=11085',
                dataType: 'JSON',
                error: function () {
                    //layer.msg('网络错误');
                },
                success: function (res) {
                }
            });
        }
        // 发红包
        function fahongbao() {
            layer.open({
                type: 2,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['100%', '100%'],
                offset: 'b',
                anim: 2,
                content: ['/sns/fahongbao?room_id=']
            });
        }
        // 红包详情
        function hongbaoitem(id) {
            layer.open({
                type: 2,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['100%', '100%'],
                offset: 'b',
                anim: 2,
                content: ['/sns/hongbaoitem?id=' + id]
            });
        }

        function hongbaoinfo(id) {
            $('#red' + id).css('background-image', 'url(/img/hongbaobg_cur.png)');
            $.ajax({
                type: 'POST',
                url: '/sns/hongbaoshow',
                data: 'id=' + id,
                dataType: 'JSON',
                error: function () {
                    layer.alert('网络错误');
                },
                success: function (res) {
                    console.log(res.data);
                    $('#hb_avatar').attr('src', res.data.avatar)
                    $('#hb_nickname').html(res.data.nickname)
                    $('#hb_kai').attr('onclick', 'qianghongbao(' + id + ')')
                    if (res.data.status == 0) {
                        $('#hb_title').html('恭喜发财,大吉大利');
                        $('#hb_btn').show()
                        $('#hb_link').hide()
                    } else {
                        $('#hb_title').html('红包已抢完');
                        $('#hb_btn').hide()
                        $('#hb_link').html('<a href="javascript:hongbaoitem(' + id + ')">查看详情</a>')
                        $('#hb_link').show()
                    }
                    $('.red_box').toggle()
                }
            });
        }
        function qianghongbao(id) {
            $.ajax({
                type: 'POST',
                url: '/sns/hongbaoget',
                data: 'id=' + id,
                dataType: 'JSON',
                error: function () {
                    layer.alert('网络错误');
                },
                success: function (res) {
                    console.log(res.data);
                    if (res.errcode == 0) {
                        layer.msg('抢包成功')
                        if (res.data.islei) {
                            ws.send('{"keytype":"lei", "money":"' + res.data.money + '", "islei_money":"' + res.data.islei_money + '", "nickname":"' + res.data.nickname + '"}');
                        } else {
                            if (res.data.jiangli > 0) {
                                ws.send('{"keytype":"jiangli", "money":"' + res.data.money + '", "jiangli":"' + res.data.jiangli + '", "nickname":"' + res.data.nickname + '"}');
                            }
                            $('#saylist').append('<div class="alert alert-info sayonline" role="alert">您抢了<em>' + res.data.money + '</em>元红包</div>');
                        }
                        setTimeout(function () {
                            $('.red_box').toggle()
                        }, 500)
                    } else {
                        layer.msg(res.errmsg)
                    }
                }
            });
        }
        function hidehongbao() {
            $('.red_box').hide()
        }
        $(function () {
            setPasteImg();
        })
        //获取粘贴板上的图片
        function setPasteImg() {
            //粘贴事件
            document.addEventListener('paste', function (event) {

                if (event.clipboardData || event.originalEvent) {
                    var clipboardData = (event.clipboardData || event.originalEvent.clipboardData);
                    if (clipboardData.items) {
                        var blob;
                        for (var i = 0; i < clipboardData.items.length; i++) {
                            if (clipboardData.items[i].type.indexOf("image") !== -1) {
                                blob = clipboardData.items[i].getAsFile();
                            }
                        }
                        var render = new FileReader();
                        render.onload = function (evt) {
                            //输出base64编码
                            var base64 = evt.target.result;
                            //document.getElementById('img').setAttribute('src', base64);
                            console.log(base64)
                            layer.msg('正在粘贴图片');
                            $.ajax({
                                type: 'POST',
                                url: '/index/uploadBase64',
                                data: 'basedata=' + base64,
                                dataType: 'JSON',
                                error: function () {
                                    layer.alert('网络错误');
                                },
                                success: function (res) {
                                    if (res.errcode == 0) {
                                        console.log(res);
                                        sendData('img', 'http://chatcdn.tianqiapi.com' + res.data.img);
                                        window.clipboardData.setData("Text", "")
                                    } else {
                                        layer.msg(res.errmsg);
                                    }
                                }
                            });
                        }
                        render.readAsDataURL(blob);
                    }
                }
            })
        }

        function showmap() {
            layer.open({
                type: 2,
                title: '发送位置',
                closeBtn: 1,
                shadeClose: true,
                area: ['95%', '90%'],

                anim: 2,
                content: ['/sns/showmap']
            });
        }
        function showplusbox() {
            $('#plusbox').toggle()
        }
    </script>

</body></html>